package thread.desgin.single;

/**
 * 饿汉式在多线程下的执行情况<br/>
 * @author lyil
 *
 */
public class MySingletonThread extends Thread{

	/*
	 * 获取MySingleton实列对象<br/>
	 * @see java.lang.Runnable#run()
	 */
	public void run() {
		System.out.println(MySingleton.getInstance().hashCode());  
	}
	
	public static void main(String[] args) {   
        
		MySingletonThread[] mts = new MySingletonThread[10];  
        for(int i = 0 ; i < mts.length ; i++){  
            mts[i] = new MySingletonThread();  
        }  
          
        for (int j = 0; j < mts.length; j++) {  
            mts[j].start();
            System.out.println(Thread.currentThread().getName());
        }  
    }  
}
